package myjava.data;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Root1 {

   public static void main(String[] args) {

      // now
      Date d1 = new Date();
      System.out.println(d1.toString());

      // somewhere in time after 1st jannuary 1970
      Date d2 = new Date(1200000000000L);
      System.out.println(d2.toString());

      // differenza tra 2 date
      System.out.println(d1.getTime() - d2.getTime());


      String DATE_FORMAT = "yyyy-MM-dd H:m:s";
      SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
      Calendar c1 = Calendar.getInstance(); // today
      System.out.println("Today is " + sdf.format(c1.getTime()));


   }
}
